$(function () {
    let id = localStorage.getItem("serviceId");
    findByTypeId(id);
});
function findByTypeId(id) {
    let result = myAjax('/back/service/findByTypeId','get',{id:id,token:$.cookie("token")});
    showData(result.serviceItemsModel);
}
//打开编辑页面 直接给里面选项进行赋值
function showData(data) {
    $("#serviceId").val(data.id);
    $("#serviceType").val(data.serviceType);
    $("#showHref").val(data.showHref);
}
function serviceEdit() {
    let data = {};
    data.id=$("#serviceId").val();
    data.serviceType=$("#serviceType").val();
    data.showHref=$("#showHref").val();
    data.token=$.cookie("token");
    let result = myAjax('/back/service/serviceEdit','post',data);
    if (result.result === 1) {
        alert("提交成功");
        $("#right").load('/back/service/serviceManage.html');
    } else {
        alert("提交失败")
    }
}
function cancelEdit() {
    $("#right").load('/back/service/serviceManage.html');
}
